{% extends 'layout.html' %}

{% block content %}
<div class="container">

    <div>
        <div style="margin-bottom: 10px; ">
            <a class="btn btn-primary" href="/tools/admin/add/" target="_blank">新建管理员</a>

            <div style="float: right; width: 300px;">
                <form method="get">
                    <div class="input-group">
                        <input type="text" name="query" class="form-control" placeholder="Search for..."
                            value="{{ search_data }}">
                        <span class="input-group-btn">
                            <button class="btn btn-default" type="submit">
                                <span class="glyphicon glyphicon-search" aria-hidden="true"></span>
                            </button>
                        </span>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <div>
        <div class="panel panel-default">
            <!-- Default panel contents -->
            <div class="panel-heading">
                <span class="glyphicon glyphicon-th-list" aria-hidden="true" style="margin-right: 5px;"></span>
                <span>管理员列表</span>
            </div>

            <!-- Table -->
            <table class="table table-bordered">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>姓名</th>
                        <th>密码</th>
                        <th>重置密码</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    {% for obj in page_queryset %}
                    <tr>
                        <th>{{ obj.id }}</th>
                        <td>{{ obj.username }}</td>
                        <td>{{ obj.password }}</td>
                        <td>
                            <a href="/tools/admin/{{ obj.id }}/reset/">重置密码</a>
                        </td>
                        <td>
                            <a class="btn btn-primary btn-xs" href="/tools/admin/{{ obj.id }}/edit/">编辑</a>
                            <a class="btn btn-danger btn-xs" href="/tools/admin/{{ obj.id }}/delete/">删除</a>
                        </td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
    </div>

    <ul class="pagination">
        {{ page_string }}
    </ul>
    <br>

{#    <form method="get">#}
{#        <div style="display:inline-block; width: 150px;">#}
{#            <div class="input-group">#}
{#                <span> <input type="text" class="form-control" placeholder="请输入页码" name="page"></span>#}
{#                <span class="input-group-btn">#}
{#                    <button class="btn btn-primary" type="submit">跳转</button>#}
{#                </span>#}
{#            </div>#}
{#        </div>#}
{#    </form>#}
</div>

{% endblock %}
